<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>功能说明</title>
    <script th:src="@{/js/jquery.js}"></script>
    <style>
        .aLink {
            text-decoration: none;
        }

        .aLink:hover {
            text-decoration: underline;
        }
        .submitButton {
            margin-top: 20px;
            margin-left: 250px;
        }
        .common {
            margin-top: 20px;
            margin-left: 250px;
            position: center;
        }
    </style>
</head>
<body>
<div>
    <h1 style="text-align: center;"><strong>已有功能</strong></h1>
    <hr color=#987cb9 style=" width:80%;">
    <br>
    <div class="submitButton">
        <!--<a href="/hi/image/page" target="_blank">跳转</a>-->
        <a id="imageToPdf" class="aLink" href="javascript:void(0);">图片转Pdf</a>
    </div>
    <div class="submitButton">
        <a id="idCard" class="aLink" href="javascript:void(0);">获取身份证信息</a>
    </div>
    <div class="submitButton">
        <a id="fileRead" class="aLink" th:href="@{/page/file}">文件读取</a>
    </div>
    <div class="submitButton">
        <a id="docToPdf" class="aLink" th:href="@{/doc/page}">Doc转Pdf</a>
    </div>
    <div class="submitButton">
        <a id="loveTalk" class="aLink" th:href="@{/util/loveTalk}">土味情话</a>
    </div>

    <div class="submitButton">
        <a id="wyyComment" class="aLink" href="#" onclick="wyyComment()">网易云热评</a>
    </div>


    <div class="submitButton">
        <a id="weather" class="aLink" href="javascript:void(0);">获取天气</a>
    </div>
</div>

<br>
<hr color=#987cb9 style=" width:80%;">
<br>

<div>
    <div class="common">
        <p id="commonContent"></p>
    </div>
</div>

</body>
<script>
    //获取项目根路径
    function getRootPath() {
        let curWwwPath = window.document.location.href;
        let pathName = window.document.location.pathname;
        let pos = curWwwPath.indexOf(pathName);
        return pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
    }

    function wyyComment() {
        $.get({
            url: "/hi/util/wyyComment",
            processData: false, // 告诉jQuery不要去处理发送的数据
            contentType: false, // 告诉jQuery不要去设置Content-Type请求头
            success: function (res) {
                let contentArray = res.split("###&&&");
                $('#commonContent').text("")
                $.each(contentArray, function(){
                    $('#commonContent').append('<p>' + this + '</p>');
                });
            },
            error: function (res) {
                console.log(res)
                alert("服务器异常")
            }
        })
    }

    // 设置功能链接
    document.getElementById('imageToPdf').href = getRootPath() + '/image/page';

    document.getElementById('idCard').href = getRootPath() + '/page/idCard';

    document.getElementById('weather').href = getRootPath() + '/page/weather';
</script>
</html>
